import App from './App'
import { $http } from '@escook/request-miniprogram'
 $http.baseUrl = 'http://8.134.76.242:8080'
import store from '@/store/store.js' // 引入store
uni.$http =$http
uni.baseUrl = 'http://8.134.76.242:8080'

$http.beforeRequest = function(option){
	uni.showLoading({
		title:'数据加载中...'
	})
	
	if(option.url.indexOf('/my/')!=-1){
		option.header ={
			Authorization: store.state.m_user.token
		}
	}
}
$http.afterRequest = function(){
	uni.hideLoading()
}

// #ifndef VUE3
import Vue from 'vue'
import './uni.promisify.adaptor'

Vue.config.productionTip = false
App.mpType = 'app'
const app = new Vue({
  ...App
})
app.$mount()
// #endif

// #ifdef VUE3
import { createSSRApp } from 'vue'
export function createApp() {
  const app = createSSRApp(App)
  app.config.globalProperties.$showMsg = function(title = '数据加载失败！',duration = 1500){
  	uni.showToast({
  		title,
  		duration,
  		icon:'none'
  	})
  }
  app.use(store)
  return {
    app
  }
}
// #endif